@extends('layouts.admin')
@push('morecss')
    <link href="/vendor/AdminInspinia/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
@endpush

@push('morescript')
    <!--webuploader上传组件JS-->
    <script type="text/javascript" src="/vendor/webuploader/webuploader.js"></script>
    <script type="application/javascript">
        let page_params = {
            @can('admin.wxmppaylist.index')
            url_list : '{{ route('admin.wxmppaylist.index') }}',
            @endcan
            @can('admin.wxmppaylist.create')
            url_add : '{{ route('admin.wxmppaylist.create') }}',
            @endcan
            @can('admin.wxmppaylist.update')
            url_edit : '{{ route('admin.wxmppaylist.update') }}',
            @endcan
            @can('admin.wxmppaylist.destroy')
            url_del: '{{ route('admin.wxmppaylist.destroy') }}',
            @endcan
        }
    </script>
    <!-- require page js -->
    <script src="{{ mix('js/admin/wxmppaylist_index.js') }}"></script>
@endpush
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight ecommerce">
        <div class="ibox-content m-b-sm border-bottom">
            <div class="row">
                <div class="col-sm-4">
                    <div class="form-group">
                        <label class="control-label" for="product_name">关键字</label>
                        <input type="text" id="keyword" name="keyword" value="" v-model="searchParams.keyword" placeholder="请输入搜索关键字"
                               class="form-control">
                    </div>
                </div>
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label" for="product_name">&nbsp;&nbsp;</label>
                        <div>
                            <button class="btn btn-primary" type="button" v-on:click="query"><i class="fa fa-search"></i>
                                搜索
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="toolbar" class="col-sm-2">
            @can('admin.wxmppaylist.create')
                <button class="btn btn-primary" v-on:click="add"><i class="fa fa-plus"></i> 添加</button>
            @endcan
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox">
                    <div class="ibox-content">
                        <table id="table" data-classes="table table-no-bordered">
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 用户编辑 -->
    <div class="ibox-content" id="box-form" style="display: none;">
        <form method="POST" class="form-horizontal" action="">
            <div class="form-group">
                <label class="col-sm-2 control-label">应用名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="nick_name" id="nick_name"  v-model="cur_mp_data.nick_name" required value="">
                    <span class="help-block m-b-none"></span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">头像</label>
                <div class="col-sm-10">
                    <webuploader-single :view-url.sync="cur_mp_data.head_img" btn-text="选择头像"></webuploader-single>
                    <span class="help-block m-b-none">建议上传小于1M的图片.</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">使用状态</label>
                <div class="col-sm-10">
                    <div class="input-group">
                        <div class="radio radio-primary radio-inline">
                            <input type="radio" id="is_enable_1" value="1" name="is_enable" v-model="cur_mp_data.is_enable">
                            <label for="is_enable_1">正常 </label>
                        </div>
                        <div class="radio radio-primary radio-inline">
                            <input type="radio" id="is_enable_0" value="0" name="is_enable" v-model="cur_mp_data.is_enable">
                            <label for="is_enable_0"> 禁用 </label>
                        </div>
                    </div>
                    <span class="help-block m-b-none">设置是否可用</span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">微信应用ID</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="appid" id="appid" v-model="cur_mp_data.appid" required value="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商户号</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="mch_id" id="mch_id" v-model="cur_mp_data.mch_id" required value="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商户API密钥</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="key" id="key" v-model="cur_mp_data.key" required value="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商户API证书cert路径</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="cert_path" id="cert_path" v-model="cur_mp_data.cert_path" required value="">
                    <span class="help-block m-b-none">相对路径，证书文件放在storage\certificate目录下，填写此路径的相对目录即可，如shanghu1/cert.pem</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商户API证书key路径</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="key_path" id="key_path" v-model="cur_mp_data.key_path" required value="">
                    <span class="help-block m-b-none">相对路径，证书文件放在storage\certificate目录下，填写此路径的相对目录即可，如shanghu1/key.pem</span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">是否默认</label>
                <div class="col-sm-10">
                    <div class="input-group">
                        <div class="radio radio-primary radio-inline">
                            <input type="radio" id="is_default_1" value="1" name="is_default" v-model="cur_mp_data.is_default">
                            <label for="is_enable_1">是 </label>
                        </div>
                        <div class="radio radio-primary radio-inline">
                            <input type="radio" id="is_default_0" value="0" name="is_default" v-model="cur_mp_data.is_default">
                            <label for="is_enable_0"> 否 </label>
                        </div>
                    </div>
                    <span class="help-block m-b-none">设置默认，在使用EasyWechat门面时无需指定AppId</span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-4">
                    <button class="btn btn-primary btn-sub" type="button" v-on:click="save">
                        保存
                    </button>
                </div>
            </div>
        </form>
    </div>
@endsection